stopme 

Stops the process in which this command was run. Stopme  cannot be used to stop a turtle inside a color instruction. In this case, use clickoff  instead. See stop and stopall.

Example: 

The action will stop when turtle 1 will be more than 100 steps away from turtle 2.

forever [fd 1 if (distance "t2) > 100 [stopme]]